<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="名称">
        <el-input v-model="form.pageName"></el-input>
      </el-form-item>
      <el-form-item label="类型">
        <el-select v-model="form.pageType">
          <el-option v-for="item in types" :key="item.value" :value="item.value" :label="item.label"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="add">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  mounted(){
    console.log( this.$refs.form)
  },
  methods:{
    async add(){
      await axios.post("http://localhost:8811/api/DynamicPage/Add",this.form)
      this.$router.push('/pages')
    }
  },
  data(){
    return {
      types:[
        {label:"列表",value:1},
        {label:"表单",value:2}
      ],
      form:{
        pageName:"",
        pageType:1
      }
    }
  }
}
</script>

<style>

</style>